package com.feasy.generator.generatorcode.utils;

import org.springframework.jdbc.support.JdbcUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUstils {

    /**
     * propertiesName 例如generator.properties 要放在resources 目录下.
     */
    public static String getString(String propertiesName, String paramName) {
        String paramValue = "";
        try {
            Properties p = new Properties();
            //获取文件的流
            InputStream inStream = JdbcUtils.class.getClassLoader().getResourceAsStream(propertiesName);
            p.load(inStream);
            paramValue = p.getProperty(paramName);
        } catch (IOException e) {
            e.printStackTrace();
        }
    return paramValue;
    }
}
